home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Bank smakow / BankSmakow.air / BankSmakow.swf / scripts / mx / controls / TextInput.as < prev    next >
Text File  |  2009-12-16  |  29KB  |  933 lines

  1. package mx.controls
  2. {
  3.    import flash.accessibility.AccessibilityProperties;
  4.    import flash.display.DisplayObject;
  5.    import flash.events.Event;
  6.    import flash.events.FocusEvent;
  7.    import flash.events.KeyboardEvent;
  8.    import flash.events.TextEvent;
  9.    import flash.system.IME;
  10.    import flash.system.IMEConversionMode;
  11.    import flash.text.TextField;
  12.    import flash.text.TextFieldAutoSize;
  13.    import flash.text.TextFieldType;
  14.    import flash.text.TextLineMetrics;
  15.    import flash.ui.Keyboard;
  16.    import mx.controls.listClasses.BaseListData;
  17.    import mx.controls.listClasses.IDropInListItemRenderer;
  18.    import mx.controls.listClasses.IListItemRenderer;
  19.    import mx.core.EdgeMetrics;
  20.    import mx.core.FlexVersion;
  21.    import mx.core.IDataRenderer;
  22.    import mx.core.IFlexDisplayObject;
  23.    import mx.core.IFlexModuleFactory;
  24.    import mx.core.IFontContextComponent;
  25.    import mx.core.IIMESupport;
  26.    import mx.core.IInvalidating;
  27.    import mx.core.IRectangularBorder;
  28.    import mx.core.IUITextField;
  29.    import mx.core.UIComponent;
  30.    import mx.core.UITextField;
  31.    import mx.core.mx_internal;
  32.    import mx.events.FlexEvent;
  33.    import mx.managers.IFocusManager;
  34.    import mx.managers.IFocusManagerComponent;
  35.    import mx.styles.ISimpleStyleClient;
  36.    
  37.    use namespace mx_internal;
  38.    
  39.    public class TextInput extends UIComponent implements IDataRenderer, IDropInListItemRenderer, IFocusManagerComponent, IIMESupport, IListItemRenderer, IFontContextComponent
  40.    {
  41.       
  42.       mx_internal static const VERSION:String = "3.5.0.12683";
  43.        
  44.       
  45.       private var _text:String = "";
  46.       
  47.       private var _textWidth:Number;
  48.       
  49.       private var _restrict:String;
  50.       
  51.       private var htmlTextChanged:Boolean = false;
  52.       
  53.       mx_internal var border:IFlexDisplayObject;
  54.       
  55.       private var enabledChanged:Boolean = false;
  56.       
  57.       private var _maxChars:int = 0;
  58.       
  59.       private var _condenseWhite:Boolean = false;
  60.       
  61.       private var accessibilityPropertiesChanged:Boolean = false;
  62.       
  63.       private var _textHeight:Number;
  64.       
  65.       private var displayAsPasswordChanged:Boolean = false;
  66.       
  67.       private var prevMode:String = "UNKNOWN";
  68.       
  69.       private var selectableChanged:Boolean = false;
  70.       
  71.       private var restrictChanged:Boolean = false;
  72.       
  73.       private var selectionChanged:Boolean = false;
  74.       
  75.       private var _data:Object;
  76.       
  77.       private var maxCharsChanged:Boolean = false;
  78.       
  79.       private var _tabIndex:int = -1;
  80.       
  81.       private var errorCaught:Boolean = false;
  82.       
  83.       private var _selectionBeginIndex:int = 0;
  84.       
  85.       private var explicitHTMLText:String = null;
  86.       
  87.       private var editableChanged:Boolean = false;
  88.       
  89.       mx_internal var parentDrawsFocus:Boolean = false;
  90.       
  91.       private var tabIndexChanged:Boolean = false;
  92.       
  93.       private var _horizontalScrollPosition:Number = 0;
  94.       
  95.       private var _editable:Boolean = true;
  96.       
  97.       private var _imeMode:String = null;
  98.       
  99.       private var condenseWhiteChanged:Boolean = false;
  100.       
  101.       protected var textField:IUITextField;
  102.       
  103.       private var _listData:BaseListData;
  104.       
  105.       private var _displayAsPassword:Boolean = false;
  106.       
  107.       private var textChanged:Boolean = false;
  108.       
  109.       private var _htmlText:String = "";
  110.       
  111.       private var _accessibilityProperties:AccessibilityProperties;
  112.       
  113.       private var _selectionEndIndex:int = 0;
  114.       
  115.       private var textSet:Boolean;
  116.       
  117.       private var horizontalScrollPositionChanged:Boolean = false;
  118.       
  119.       private var _selectable:Boolean = true;
  120.       
  121.       public function TextInput()
  122.       {
  123.          super();
  124.          tabChildren = true;
  125.       }
  126.       
  127.       public function get imeMode() : String
  128.       {
  129.          return _imeMode;
  130.       }
  131.       
  132.       public function set imeMode(param1:String) : void
  133.       {
  134.          _imeMode = param1;
  135.       }
  136.       
  137.       override protected function focusOutHandler(param1:FocusEvent) : void
  138.       {
  139.          super.focusOutHandler(param1);
  140.          if(_imeMode != null && _editable)
  141.          {
  142.             if(IME.conversionMode != IMEConversionMode.UNKNOWN && prevMode != IMEConversionMode.UNKNOWN)
  143.             {
  144.                IME.conversionMode = prevMode;
  145.             }
  146.             IME.enabled = false;
  147.          }
  148.          dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  149.       }
  150.       
  151.       override public function drawFocus(param1:Boolean) : void
  152.       {
  153.          if(mx_internal::parentDrawsFocus)
  154.          {
  155.             IFocusManagerComponent(parent).drawFocus(param1);
  156.             return;
  157.          }
  158.          super.drawFocus(param1);
  159.       }
  160.       
  161.       mx_internal function getTextField() : IUITextField
  162.       {
  163.          return textField;
  164.       }
  165.       
  166.       private function textField_textInputHandler(param1:TextEvent) : void
  167.       {
  168.          param1.stopImmediatePropagation();
  169.          var _loc2_:TextEvent = new TextEvent(TextEvent.TEXT_INPUT,false,true);
  170.          _loc2_.text = param1.text;
  171.          dispatchEvent(_loc2_);
  172.          if(_loc2_.isDefaultPrevented())
  173.          {
  174.             param1.preventDefault();
  175.          }
  176.       }
  177.       
  178.       override public function get accessibilityProperties() : AccessibilityProperties
  179.       {
  180.          return _accessibilityProperties;
  181.       }
  182.       
  183.       override protected function createChildren() : void
  184.       {
  185.          super.createChildren();
  186.          createBorder();
  187.          createTextField(-1);
  188.       }
  189.       
  190.       private function textFieldChanged(param1:Boolean, param2:Boolean) : void
  191.       {
  192.          var _loc3_:* = false;
  193.          var _loc4_:* = false;
  194.          if(!param1)
  195.          {
  196.             _loc3_ = _text != textField.text;
  197.             _text = textField.text;
  198.          }
  199.          _loc4_ = _htmlText != textField.htmlText;
  200.          _htmlText = textField.htmlText;
  201.          if(_loc3_)
  202.          {
  203.             dispatchEvent(new Event("textChanged"));
  204.             if(param2)
  205.             {
  206.                dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  207.             }
  208.          }
  209.          if(_loc4_)
  210.          {
  211.             dispatchEvent(new Event("htmlTextChanged"));
  212.          }
  213.          _textWidth = textField.textWidth;
  214.          _textHeight = textField.textHeight;
  215.       }
  216.       
  217.       [NonCommittingChangeEvent("change")]
  218.       [Bindable("textChanged")]
  219.       public function get text() : String
  220.       {
  221.          return _text;
  222.       }
  223.       
  224.       mx_internal function createTextField(param1:int) : void
  225.       {
  226.          if(!textField)
  227.          {
  228.             textField = IUITextField(createInFontContext(UITextField));
  229.             textField.autoSize = TextFieldAutoSize.NONE;
  230.             textField.enabled = enabled;
  231.             textField.ignorePadding = false;
  232.             textField.multiline = false;
  233.             textField.tabEnabled = true;
  234.             textField.wordWrap = false;
  235.             if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  236.             {
  237.                textField.styleName = this;
  238.             }
  239.             textField.addEventListener(Event.CHANGE,textField_changeHandler);
  240.             textField.addEventListener(TextEvent.TEXT_INPUT,textField_textInputHandler);
  241.             textField.addEventListener(Event.SCROLL,textField_scrollHandler);
  242.             textField.addEventListener("textFieldStyleChange",textField_textFieldStyleChangeHandler);
  243.             textField.addEventListener("textFormatChange",textField_textFormatChangeHandler);
  244.             textField.addEventListener("textInsert",textField_textModifiedHandler);
  245.             textField.addEventListener("textReplace",textField_textModifiedHandler);
  246.             textField.addEventListener("nativeDragDrop",textField_nativeDragDropHandler);
  247.             if(param1 == -1)
  248.             {
  249.                addChild(DisplayObject(textField));
  250.             }
  251.             else
  252.             {
  253.                addChildAt(DisplayObject(textField),param1);
  254.             }
  255.          }
  256.       }
  257.       
  258.       override public function get tabIndex() : int
  259.       {
  260.          return _tabIndex;
  261.       }
  262.       
  263.       override public function set accessibilityProperties(param1:AccessibilityProperties) : void
  264.       {
  265.          if(param1 == _accessibilityProperties)
  266.          {
  267.             return;
  268.          }
  269.          _accessibilityProperties = param1;
  270.          accessibilityPropertiesChanged = true;
  271.          invalidateProperties();
  272.       }
  273.       
  274.       public function setSelection(param1:int, param2:int) : void
  275.       {
  276.          _selectionBeginIndex = param1;
  277.          _selectionEndIndex = param2;
  278.          selectionChanged = true;
  279.          invalidateProperties();
  280.       }
  281.       
  282.       [Bindable("condenseWhiteChanged")]
  283.       public function get condenseWhite() : Boolean
  284.       {
  285.          return _condenseWhite;
  286.       }
  287.       
  288.       override protected function isOurFocus(param1:DisplayObject) : Boolean
  289.       {
  290.          return param1 == textField || super.isOurFocus(param1);
  291.       }
  292.       
  293.       [Bindable("displayAsPasswordChanged")]
  294.       public function get displayAsPassword() : Boolean
  295.       {
  296.          return _displayAsPassword;
  297.       }
  298.       
  299.       public function set data(param1:Object) : void
  300.       {
  301.          var _loc2_:* = undefined;
  302.          _data = param1;
  303.          if(_listData)
  304.          {
  305.             _loc2_ = _listData.label;
  306.          }
  307.          else if(_data != null)
  308.          {
  309.             if(_data is String)
  310.             {
  311.                _loc2_ = String(_data);
  312.             }
  313.             else
  314.             {
  315.                _loc2_ = _data.toString();
  316.             }
  317.          }
  318.          if(_loc2_ !== undefined && !textSet)
  319.          {
  320.             text = _loc2_;
  321.             textSet = false;
  322.             textField.setSelection(0,0);
  323.          }
  324.          dispatchEvent(new FlexEvent(FlexEvent.DATA_CHANGE));
  325.       }
  326.       
  327.       public function get selectionBeginIndex() : int
  328.       {
  329.          return !!textField ? int(textField.selectionBeginIndex) : int(_selectionBeginIndex);
  330.       }
  331.       
  332.       mx_internal function get selectable() : Boolean
  333.       {
  334.          return _selectable;
  335.       }
  336.       
  337.       protected function createBorder() : void
  338.       {
  339.          var _loc1_:Class = null;
  340.          if(!mx_internal::border)
  341.          {
  342.             _loc1_ = getStyle("borderSkin");
  343.             if(_loc1_ != null)
  344.             {
  345.                border = new _loc1_();
  346.                if(mx_internal::border is ISimpleStyleClient)
  347.                {
  348.                   ISimpleStyleClient(mx_internal::border).styleName = this;
  349.                }
  350.                addChildAt(DisplayObject(mx_internal::border),0);
  351.                invalidateDisplayList();
  352.             }
  353.          }
  354.       }
  355.       
  356.       [Bindable("horizontalScrollPositionChanged")]
  357.       public function get horizontalScrollPosition() : Number
  358.       {
  359.          return _horizontalScrollPosition;
  360.       }
  361.       
  362.       override protected function measure() : void
  363.       {
  364.          var _loc2_:Number = NaN;
  365.          var _loc3_:Number = NaN;
  366.          var _loc4_:TextLineMetrics = null;
  367.          super.measure();
  368.          var _loc1_:EdgeMetrics = mx_internal::border && mx_internal::border is IRectangularBorder ? IRectangularBorder(mx_internal::border).borderMetrics : EdgeMetrics.EMPTY;
  369.          measuredWidth = DEFAULT_MEASURED_WIDTH;
  370.          if(maxChars)
  371.          {
  372.             measuredWidth = Math.min(measuredWidth,measureText("W").width * maxChars + _loc1_.left + _loc1_.right + 8);
  373.          }
  374.          if(!text || text == "")
  375.          {
  376.             _loc2_ = DEFAULT_MEASURED_MIN_WIDTH;
  377.             _loc3_ = measureText(" ").height + _loc1_.top + _loc1_.bottom + UITextField.TEXT_HEIGHT_PADDING;
  378.             if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  379.             {
  380.                _loc3_ += getStyle("paddingTop") + getStyle("paddingBottom");
  381.             }
  382.          }
  383.          else
  384.          {
  385.             _loc2_ = (_loc4_ = measureText(text)).width + _loc1_.left + _loc1_.right + 8;
  386.             _loc3_ = _loc4_.height + _loc1_.top + _loc1_.bottom + UITextField.TEXT_HEIGHT_PADDING;
  387.             if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  388.             {
  389.                _loc2_ += getStyle("paddingLeft") + getStyle("paddingRight");
  390.                _loc3_ += getStyle("paddingTop") + getStyle("paddingBottom");
  391.             }
  392.          }
  393.          measuredWidth = Math.max(_loc2_,measuredWidth);
  394.          measuredHeight = Math.max(_loc3_,DEFAULT_MEASURED_HEIGHT);
  395.          measuredMinWidth = DEFAULT_MEASURED_MIN_WIDTH;
  396.          measuredMinHeight = DEFAULT_MEASURED_MIN_HEIGHT;
  397.       }
  398.       
  399.       public function get fontContext() : IFlexModuleFactory
  400.       {
  401.          return moduleFactory;
  402.       }
  403.       
  404.       public function set text(param1:String) : void
  405.       {
  406.          textSet = true;
  407.          if(!param1)
  408.          {
  409.             param1 = "";
  410.          }
  411.          if(!isHTML && param1 == _text)
  412.          {
  413.             return;
  414.          }
  415.          _text = param1;
  416.          textChanged = true;
  417.          _htmlText = null;
  418.          explicitHTMLText = null;
  419.          invalidateProperties();
  420.          invalidateSize();
  421.          invalidateDisplayList();
  422.          dispatchEvent(new Event("textChanged"));
  423.          dispatchEvent(new FlexEvent(FlexEvent.VALUE_COMMIT));
  424.       }
  425.       
  426.       public function get selectionEndIndex() : int
  427.       {
  428.          return !!textField ? int(textField.selectionEndIndex) : int(_selectionEndIndex);
  429.       }
  430.       
  431.       [Bindable("editableChanged")]
  432.       public function get editable() : Boolean
  433.       {
  434.          return _editable;
  435.       }
  436.       
  437.       [Bindable("dataChange")]
  438.       public function get listData() : BaseListData
  439.       {
  440.          return _listData;
  441.       }
  442.       
  443.       override protected function keyDownHandler(param1:KeyboardEvent) : void
  444.       {
  445.          switch(param1.keyCode)
  446.          {
  447.             case Keyboard.ENTER:
  448.                dispatchEvent(new FlexEvent(FlexEvent.ENTER));
  449.                if(textChanged || htmlTextChanged)
  450.                {
  451.                   validateNow();
  452.                }
  453.          }
  454.       }
  455.       
  456.       override protected function focusInHandler(param1:FocusEvent) : void
  457.       {
  458.          var message:String = null;
  459.          var event:FocusEvent = param1;
  460.          if(event.target == this)
  461.          {
  462.             systemManager.stage.focus = TextField(textField);
  463.          }
  464.          var fm:IFocusManager = focusManager;
  465.          if(editable && fm)
  466.          {
  467.             fm.showFocusIndicator = true;
  468.             if(textField.selectable && _selectionBeginIndex == _selectionEndIndex)
  469.             {
  470.                textField.setSelection(0,textField.length);
  471.             }
  472.          }
  473.          super.focusInHandler(event);
  474.          if(_imeMode != null && _editable)
  475.          {
  476.             IME.enabled = true;
  477.             prevMode = IME.conversionMode;
  478.             try
  479.             {
  480.                if(!errorCaught && IME.conversionMode != IMEConversionMode.UNKNOWN)
  481.                {
  482.                   IME.conversionMode = _imeMode;
  483.                }
  484.                errorCaught = false;
  485.             }
  486.             catch(e:Error)
  487.             {
  488.                errorCaught = true;
  489.                message = resourceManager.getString("controls","unsupportedMode",[_imeMode]);
  490.                throw new Error(message);
  491.             }
  492.          }
  493.       }
  494.       
  495.       [NonCommittingChangeEvent("change")]
  496.       [Bindable("htmlTextChanged")]
  497.       public function get htmlText() : String
  498.       {
  499.          return _htmlText;
  500.       }
  501.       
  502.       override public function set tabIndex(param1:int) : void
  503.       {
  504.          if(param1 == _tabIndex)
  505.          {
  506.             return;
  507.          }
  508.          _tabIndex = param1;
  509.          tabIndexChanged = true;
  510.          invalidateProperties();
  511.       }
  512.       
  513.       public function set restrict(param1:String) : void
  514.       {
  515.          if(param1 == _restrict)
  516.          {
  517.             return;
  518.          }
  519.          _restrict = param1;
  520.          restrictChanged = true;
  521.          invalidateProperties();
  522.          dispatchEvent(new Event("restrictChanged"));
  523.       }
  524.       
  525.       private function textField_textFieldStyleChangeHandler(param1:Event) : void
  526.       {
  527.          textFieldChanged(true,false);
  528.       }
  529.       
  530.       private function textField_nativeDragDropHandler(param1:Event) : void
  531.       {
  532.          textField_changeHandler(param1);
  533.       }
  534.       
  535.       private function textField_changeHandler(param1:Event) : void
  536.       {
  537.          textFieldChanged(false,false);
  538.          textChanged = false;
  539.          htmlTextChanged = false;
  540.          param1.stopImmediatePropagation();
  541.          dispatchEvent(new Event(Event.CHANGE));
  542.       }
  543.       
  544.       override public function set enabled(param1:Boolean) : void
  545.       {
  546.          if(param1 == enabled)
  547.          {
  548.             return;
  549.          }
  550.          super.enabled = param1;
  551.          enabledChanged = true;
  552.          invalidateProperties();
  553.          if(mx_internal::border && mx_internal::border is IInvalidating)
  554.          {
  555.             IInvalidating(mx_internal::border).invalidateDisplayList();
  556.          }
  557.       }
  558.       
  559.       override public function get baselinePosition() : Number
  560.       {
  561.          var _loc1_:String = null;
  562.          if(FlexVersion.compatibilityVersion < FlexVersion.VERSION_3_0)
  563.          {
  564.             _loc1_ = text;
  565.             if(_loc1_ == "")
  566.             {
  567.                _loc1_ = " ";
  568.             }
  569.             return (mx_internal::border && mx_internal::border is IRectangularBorder ? IRectangularBorder(mx_internal::border).borderMetrics.top : 0) + measureText(_loc1_).ascent;
  570.          }
  571.          if(!validateBaselinePosition())
  572.          {
  573.             return NaN;
  574.          }
  575.          return textField.y + textField.baselinePosition;
  576.       }
  577.       
  578.       public function set condenseWhite(param1:Boolean) : void
  579.       {
  580.          if(param1 == _condenseWhite)
  581.          {
  582.             return;
  583.          }
  584.          _condenseWhite = param1;
  585.          condenseWhiteChanged = true;
  586.          if(isHTML)
  587.          {
  588.             htmlTextChanged = true;
  589.          }
  590.          invalidateProperties();
  591.          invalidateSize();
  592.          invalidateDisplayList();
  593.          dispatchEvent(new Event("condenseWhiteChanged"));
  594.       }
  595.       
  596.       public function get textWidth() : Number
  597.       {
  598.          return _textWidth;
  599.       }
  600.       
  601.       public function set displayAsPassword(param1:Boolean) : void
  602.       {
  603.          if(param1 == _displayAsPassword)
  604.          {
  605.             return;
  606.          }
  607.          _displayAsPassword = param1;
  608.          displayAsPasswordChanged = true;
  609.          invalidateProperties();
  610.          invalidateSize();
  611.          invalidateDisplayList();
  612.          dispatchEvent(new Event("displayAsPasswordChanged"));
  613.       }
  614.       
  615.       mx_internal function removeTextField() : void
  616.       {
  617.          if(textField)
  618.          {
  619.             textField.removeEventListener(Event.CHANGE,textField_changeHandler);
  620.             textField.removeEventListener(TextEvent.TEXT_INPUT,textField_textInputHandler);
  621.             textField.removeEventListener(Event.SCROLL,textField_scrollHandler);
  622.             textField.removeEventListener("textFieldStyleChange",textField_textFieldStyleChangeHandler);
  623.             textField.removeEventListener("textFormatChange",textField_textFormatChangeHandler);
  624.             textField.removeEventListener("textInsert",textField_textModifiedHandler);
  625.             textField.removeEventListener("textReplace",textField_textModifiedHandler);
  626.             textField.removeEventListener("nativeDragDrop",textField_nativeDragDropHandler);
  627.             removeChild(DisplayObject(textField));
  628.             textField = null;
  629.          }
  630.       }
  631.       
  632.       [Bindable("dataChange")]
  633.       public function get data() : Object
  634.       {
  635.          return _data;
  636.       }
  637.       
  638.       public function set maxChars(param1:int) : void
  639.       {
  640.          if(param1 == _maxChars)
  641.          {
  642.             return;
  643.          }
  644.          _maxChars = param1;
  645.          maxCharsChanged = true;
  646.          invalidateProperties();
  647.          dispatchEvent(new Event("maxCharsChanged"));
  648.       }
  649.       
  650.       public function set horizontalScrollPosition(param1:Number) : void
  651.       {
  652.          if(param1 == _horizontalScrollPosition)
  653.          {
  654.             return;
  655.          }
  656.          _horizontalScrollPosition = param1;
  657.          horizontalScrollPositionChanged = true;
  658.          invalidateProperties();
  659.          dispatchEvent(new Event("horizontalScrollPositionChanged"));
  660.       }
  661.       
  662.       override public function setFocus() : void
  663.       {
  664.          textField.setFocus();
  665.       }
  666.       
  667.       [Bindable("restrictChanged")]
  668.       public function get restrict() : String
  669.       {
  670.          return _restrict;
  671.       }
  672.       
  673.       public function set fontContext(param1:IFlexModuleFactory) : void
  674.       {
  675.          this.moduleFactory = param1;
  676.       }
  677.       
  678.       public function set selectionBeginIndex(param1:int) : void
  679.       {
  680.          _selectionBeginIndex = param1;
  681.          selectionChanged = true;
  682.          invalidateProperties();
  683.       }
  684.       
  685.       public function set selectionEndIndex(param1:int) : void
  686.       {
  687.          _selectionEndIndex = param1;
  688.          selectionChanged = true;
  689.          invalidateProperties();
  690.       }
  691.       
  692.       private function textField_scrollHandler(param1:Event) : void
  693.       {
  694.          _horizontalScrollPosition = textField.scrollH;
  695.       }
  696.       
  697.       public function get textHeight() : Number
  698.       {
  699.          return _textHeight;
  700.       }
  701.       
  702.       public function set editable(param1:Boolean) : void
  703.       {
  704.          if(param1 == _editable)
  705.          {
  706.             return;
  707.          }
  708.          _editable = param1;
  709.          editableChanged = true;
  710.          invalidateProperties();
  711.          dispatchEvent(new Event("editableChanged"));
  712.       }
  713.       
  714.       override protected function commitProperties() : void
  715.       {
  716.          var _loc1_:int = 0;
  717.          super.commitProperties();
  718.          if(hasFontContextChanged() && textField != null)
  719.          {
  720.             _loc1_ = getChildIndex(DisplayObject(textField));
  721.             removeTextField();
  722.             createTextField(_loc1_);
  723.             accessibilityPropertiesChanged = true;
  724.             condenseWhiteChanged = true;
  725.             displayAsPasswordChanged = true;
  726.             enabledChanged = true;
  727.             maxCharsChanged = true;
  728.             restrictChanged = true;
  729.             tabIndexChanged = true;
  730.             textChanged = true;
  731.             selectionChanged = true;
  732.             horizontalScrollPositionChanged = true;
  733.          }
  734.          if(accessibilityPropertiesChanged)
  735.          {
  736.             textField.accessibilityProperties = _accessibilityProperties;
  737.             accessibilityPropertiesChanged = false;
  738.          }
  739.          if(condenseWhiteChanged)
  740.          {
  741.             textField.condenseWhite = _condenseWhite;
  742.             condenseWhiteChanged = false;
  743.          }
  744.          if(displayAsPasswordChanged)
  745.          {
  746.             textField.displayAsPassword = _displayAsPassword;
  747.             displayAsPasswordChanged = false;
  748.          }
  749.          if(enabledChanged || editableChanged)
  750.          {
  751.             textField.type = enabled && _editable ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
  752.             if(enabledChanged)
  753.             {
  754.                if(textField.enabled != enabled)
  755.                {
  756.                   textField.enabled = enabled;
  757.                }
  758.                enabledChanged = false;
  759.             }
  760.             selectableChanged = true;
  761.             editableChanged = false;
  762.          }
  763.          if(selectableChanged)
  764.          {
  765.             if(_editable)
  766.             {
  767.                textField.selectable = enabled;
  768.             }
  769.             else
  770.             {
  771.                textField.selectable = enabled && _selectable;
  772.             }
  773.             selectableChanged = false;
  774.          }
  775.          if(maxCharsChanged)
  776.          {
  777.             textField.maxChars = _maxChars;
  778.             maxCharsChanged = false;
  779.          }
  780.          if(restrictChanged)
  781.          {
  782.             textField.restrict = _restrict;
  783.             restrictChanged = false;
  784.          }
  785.          if(tabIndexChanged)
  786.          {
  787.             textField.tabIndex = _tabIndex;
  788.             tabIndexChanged = false;
  789.          }
  790.          if(textChanged || htmlTextChanged)
  791.          {
  792.             if(isHTML)
  793.             {
  794.                textField.htmlText = explicitHTMLText;
  795.             }
  796.             else
  797.             {
  798.                textField.text = _text;
  799.             }
  800.             textFieldChanged(false,true);
  801.             textChanged = false;
  802.             htmlTextChanged = false;
  803.          }
  804.          if(selectionChanged)
  805.          {
  806.             textField.setSelection(_selectionBeginIndex,_selectionEndIndex);
  807.             selectionChanged = false;
  808.          }
  809.          if(horizontalScrollPositionChanged)
  810.          {
  811.             textField.scrollH = _horizontalScrollPosition;
  812.             horizontalScrollPositionChanged = false;
  813.          }
  814.       }
  815.       
  816.       override public function styleChanged(param1:String) : void
  817.       {
  818.          var _loc2_:Boolean = param1 == null || param1 == "styleName";
  819.          super.styleChanged(param1);
  820.          if(_loc2_ || param1 == "borderSkin")
  821.          {
  822.             if(mx_internal::border)
  823.             {
  824.                removeChild(DisplayObject(mx_internal::border));
  825.                border = null;
  826.                createBorder();
  827.             }
  828.          }
  829.       }
  830.       
  831.       private function get isHTML() : Boolean
  832.       {
  833.          return explicitHTMLText != null;
  834.       }
  835.       
  836.       [Bindable("maxCharsChanged")]
  837.       public function get maxChars() : int
  838.       {
  839.          return _maxChars;
  840.       }
  841.       
  842.       public function get maxHorizontalScrollPosition() : Number
  843.       {
  844.          return !!textField ? Number(textField.maxScrollH) : Number(0);
  845.       }
  846.       
  847.       mx_internal function set selectable(param1:Boolean) : void
  848.       {
  849.          if(_selectable == param1)
  850.          {
  851.             return;
  852.          }
  853.          _selectable = param1;
  854.          selectableChanged = true;
  855.          invalidateProperties();
  856.       }
  857.       
  858.       public function get length() : int
  859.       {
  860.          return text != null ? int(text.length) : -1;
  861.       }
  862.       
  863.       public function set listData(param1:BaseListData) : void
  864.       {
  865.          _listData = param1;
  866.       }
  867.       
  868.       private function textField_textModifiedHandler(param1:Event) : void
  869.       {
  870.          textFieldChanged(false,true);
  871.       }
  872.       
  873.       private function textField_textFormatChangeHandler(param1:Event) : void
  874.       {
  875.          textFieldChanged(true,false);
  876.       }
  877.       
  878.       public function set htmlText(param1:String) : void
  879.       {
  880.          textSet = true;
  881.          if(!param1)
  882.          {
  883.             param1 = "";
  884.          }
  885.          _htmlText = param1;
  886.          htmlTextChanged = true;
  887.          _text = null;
  888.          explicitHTMLText = param1;
  889.          invalidateProperties();
  890.          invalidateSize();
  891.          invalidateDisplayList();
  892.          dispatchEvent(new Event("htmlTextChanged"));
  893.       }
  894.       
  895.       override protected function updateDisplayList(param1:Number, param2:Number) : void
  896.       {
  897.          var _loc3_:EdgeMetrics = null;
  898.          super.updateDisplayList(param1,param2);
  899.          if(mx_internal::border)
  900.          {
  901.             mx_internal::border.setActualSize(param1,param2);
  902.             _loc3_ = mx_internal::border is IRectangularBorder ? IRectangularBorder(mx_internal::border).borderMetrics : EdgeMetrics.EMPTY;
  903.          }
  904.          else
  905.          {
  906.             _loc3_ = EdgeMetrics.EMPTY;
  907.          }
  908.          var _loc4_:Number = getStyle("paddingLeft");
  909.          var _loc5_:Number = getStyle("paddingRight");
  910.          var _loc6_:Number = getStyle("paddingTop");
  911.          var _loc7_:Number = getStyle("paddingBottom");
  912.          var _loc8_:Number = _loc3_.left + _loc3_.right;
  913.          var _loc9_:Number = _loc3_.top + _loc3_.bottom + 1;
  914.          textField.x = _loc3_.left;
  915.          textField.y = _loc3_.top;
  916.          if(FlexVersion.compatibilityVersion >= FlexVersion.VERSION_3_0)
  917.          {
  918.             textField.x += _loc4_;
  919.             textField.y += _loc6_;
  920.             _loc8_ += _loc4_ + _loc5_;
  921.             _loc9_ += _loc6_ + _loc7_;
  922.          }
  923.          textField.width = Math.max(0,param1 - _loc8_);
  924.          textField.height = Math.max(0,param2 - _loc9_);
  925.       }
  926.       
  927.       public function getLineMetrics(param1:int) : TextLineMetrics
  928.       {
  929.          return !!textField ? textField.getLineMetrics(param1) : null;
  930.       }
  931.    }
  932. }
  933.